package com.atguigu.gulimall.order.vo;

import lombok.Data;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Data
public class OrderConfirmVo {
    private List<MemberAddressVo> memberAddressVos;
    private List<OrderItemVo> items;
    //会员积分
    private Integer integration;

    private Map<Long,Boolean> stocks;

    private String orderToken;

    public BigDecimal getTotal() {
        BigDecimal totalPrice = new BigDecimal("0");
        for (OrderItemVo cartItemVo : items) {
            totalPrice = totalPrice.add(cartItemVo.getTotalPrice());
        }
        return totalPrice;
    }

    public Integer getCount() {
        int countNum = 0;
        for (OrderItemVo cartItemVo : items) {
            countNum += cartItemVo.getAmount();
        }
        return countNum;
    }

    /** 应付价格 **/
    //BigDecimal payPrice;
    public BigDecimal getPayPrice() {
        return getTotal();
    }

}
